#!/bin/sh
#
# Startup script for openvpn server
#

# Make sure IP forwarding is enabled
echo 1 > /proc/sys/net/ipv4/ip_forward

# Make device if not present (not devfs)
if ( [ ! -c /dev/net/tun ] ) then
  # Make /dev/net directory if needed
  if ( [ ! -d /dev/net ] ) then
	mkdir -m 755 /dev/net
  fi
  mknod /dev/net/tun c 10 200
fi

# Make sure the tunnel driver is loaded
#if ( !(lsmod | grep -q "^tun") ); then
#	insmod /opt/lib/modules/tun.ko
#fi

ENABLED=yes
PROCS=openvpn
ARGS="--daemon --cd /opt/etc/openvpn --config openvpn.conf"
PREARGS=""
DESC=$PROCS
PATH=/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

. /opt/etc/init.d/rc.func
